% convert from binary array to decimal
function [d] = convert2decimal(b)
[rows cols] = size(b);
for j = 1:rows
    dec = 0;
    for i=1:cols
        dec = dec + b(j,i).*2.^(cols-i);
    end
    d(j,1) = dec;
end

